#include "signup.srpc.h"
#include "workflow/WFFacilities.h"

using namespace srpc;

static WFFacilities::WaitGroup wait_group(1);

void sig_handler(int signo)
{
	wait_group.done();
}

static void signup_done(RespSignup *response, srpc::RPCContext *context)
{
    std::cout << "response code = " << response->code() << " information = " << response->information() << "\n";
}

int main()
{
	GOOGLE_PROTOBUF_VERIFY_VERSION;
    // 指明服务端的ip和端口
	const char *ip = "127.0.0.1";
	unsigned short port = 1412;
    // 创建client对象 client_stub 
	UserService::SRPCClient client(ip, port);

    // 准备好一个参数
    ReqSignup req;
    req.set_username("admin");
    req.set_password("12345");
    // 准备调用函数
    client.Signup(&req,signup_done); // signup_done是一个回调函数
	wait_group.wait();
	google::protobuf::ShutdownProtobufLibrary();
	return 0;
}
